package cn.hackcloud.mutithread.mutilthread.producer;

public class C {
	private Object lock;

	public C(Object lock) {
		this.lock = lock;

	}

	public void getValue() {
		try {
			synchronized (lock) {
				while (ValueObject.value.equals("")) {
					lock.wait();
					System.out.println("消费者" + Thread.currentThread().getName() + "WAITING");
				}
				System.out.println("消费者" + Thread.currentThread().getName() + "RUNNABLE");
				ValueObject.value = "";
				lock.notifyAll();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
